﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FGHandler
{
    class Lap
    {
        private TimeSpan _firstSplit;
        private TimeSpan _secondSplit;
        private TimeSpan _thirdSplit;
        private TimeSpan _totaltime;
        private int _lapnumber;

        public Lap(int LapNumber, TimeSpan first, TimeSpan second, TimeSpan third,TimeSpan totaltime)
        {
            this._lapnumber = LapNumber;
            this._firstSplit = first;
            this._secondSplit = second;
            this._thirdSplit = third;
            this._totaltime = totaltime;
        }
        public int LapNumber
        {
            get { return this._lapnumber; }
        }

        public TimeSpan FirstSplit
        {
            get { return this._firstSplit; }
        }
        public TimeSpan SecondSplit
        {
            get { return this._secondSplit; }
        }
        public TimeSpan firstsplit
        {
            get { return this._firstSplit; }
        }

        public TimeSpan TotalTime
        {
            get
            {
                return this._totaltime;
            }
        }
        private string FormatTime(TimeSpan t)
        {
            int secFraction = t.Milliseconds / 10;
            return string.Format("{0}:{1:00}.{2:00}", t.Minutes, t.Seconds, secFraction);
        }

        public override string ToString()
        {
            return this.LapNumber + ". " + FormatTime(_firstSplit) + " " + FormatTime(_secondSplit) + " " + FormatTime(_totaltime);                    
            return base.ToString();
        }

        private int _NumberOfPitStops = 0;
        public int NumberOfPitStops
        {
            get { return this._NumberOfPitStops;}
            set { this._NumberOfPitStops = value; }
        }

    }
}
